#include <stdio.h>
#include <stdlib.h>
#include <PulseAudioUtils.h>

int	main(int argc, char **argv) {
    pa_sample_spec ss = {0};
    pa_simple *s = NULL;

    createPulseSampleSpecification(&ss, PA_SAMPLE_S16LE, 44100, 2);

    createPulseSimplePlay(&s, &ss);

    for (int i = 0; i < 16; i++)
    {
        char buffer[44100];
        for (int i = 0; i < sizeof(buffer); i++)
        {
            buffer[i] = random() & 0xff;
        }

        writePulseSimple(s, buffer, sizeof(buffer));
        waitPulseSimplePlayed(&s);
    }

fail:
    if (s != NULL) {
        destroyPulseSimple(&s);
    }

    return 0;
}